Don't reuse insensitive pixbufs across multiple rows. (#153984, Milosz
authorMatthias Clasen <mclasen@redhat.com>
Tue, 28 Sep 2004 19:10:39 +0000 (19:10 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Tue, 28 Sep 2004 19:10:39 +0000 (19:10 +0000)
2004-09-28  Matthias Clasen  <mclasen@redhat.com>

* gtk/gtkcellrendererpixbuf.c (gtk_cell_renderer_pixbuf_render): Don't
reuse insensitive pixbufs across multiple rows.  (#153984, Milosz
Derezynski)

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkcellrendererpixbuf.c

index 35d950bd3d7bbe2ae0b1aa72353a965eaae2755b..29aca957e0b5531d70a7faa57d0c9291bb370dea 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2004-09-28  Matthias Clasen  <mclasen@redhat.com>
 
+       * gtk/gtkcellrendererpixbuf.c (gtk_cell_renderer_pixbuf_render): Don't
+       reuse insensitive pixbufs across multiple rows.  (#153984, Milosz
+       Derezynski)
+
        * gtk/gtkmain.c (gtk_parse_args): Use gtk_get_option_group() 
        to obtain an option group with correctly set pre- and post-
        parse hooks, instead of manually calling the hooks. This fixes
index 35d950bd3d7bbe2ae0b1aa72353a965eaae2755b..29aca957e0b5531d70a7faa57d0c9291bb370dea 100644 (file)
@@ -1,5 +1,9 @@
 2004-09-28  Matthias Clasen  <mclasen@redhat.com>
 
+       * gtk/gtkcellrendererpixbuf.c (gtk_cell_renderer_pixbuf_render): Don't
+       reuse insensitive pixbufs across multiple rows.  (#153984, Milosz
+       Derezynski)
+
        * gtk/gtkmain.c (gtk_parse_args): Use gtk_get_option_group() 
        to obtain an option group with correctly set pre- and post-
        parse hooks, instead of manually calling the hooks. This fixes
index 35d950bd3d7bbe2ae0b1aa72353a965eaae2755b..29aca957e0b5531d70a7faa57d0c9291bb370dea 100644 (file)
@@ -1,5 +1,9 @@
 2004-09-28  Matthias Clasen  <mclasen@redhat.com>
 
+       * gtk/gtkcellrendererpixbuf.c (gtk_cell_renderer_pixbuf_render): Don't
+       reuse insensitive pixbufs across multiple rows.  (#153984, Milosz
+       Derezynski)
+
        * gtk/gtkmain.c (gtk_parse_args): Use gtk_get_option_group() 
        to obtain an option group with correctly set pre- and post-
        parse hooks, instead of manually calling the hooks. This fixes
index 35d950bd3d7bbe2ae0b1aa72353a965eaae2755b..29aca957e0b5531d70a7faa57d0c9291bb370dea 100644 (file)
@@ -1,5 +1,9 @@
 2004-09-28  Matthias Clasen  <mclasen@redhat.com>
 
+       * gtk/gtkcellrendererpixbuf.c (gtk_cell_renderer_pixbuf_render): Don't
+       reuse insensitive pixbufs across multiple rows.  (#153984, Milosz
+       Derezynski)
+
        * gtk/gtkmain.c (gtk_parse_args): Use gtk_get_option_group() 
        to obtain an option group with correctly set pre- and post-
        parse hooks, instead of manually calling the hooks. This fixes
index 103ae479b59167ea2f9fc4bbc6979da060f92874..3c20b4dc1747717580b5f90134373c5ec78ef98e 100644 (file)
@@ -74,7 +74,6 @@ struct _GtkCellRendererPixbufPrivate
   gchar *stock_id;
   GtkIconSize stock_size;
   gchar *stock_detail;
-  GdkPixbuf *insensitive;
 };
 
 
@@ -204,9 +203,6 @@ gtk_cell_renderer_pixbuf_finalize (GObject *object)
   if (priv->stock_detail)
     g_free (priv->stock_detail);
 
-  if (priv->insensitive)
-    g_object_unref (priv->insensitive);
-
   (* G_OBJECT_CLASS (parent_class)->finalize) (object);
 }
 
@@ -437,6 +433,7 @@ gtk_cell_renderer_pixbuf_render (GtkCellRenderer      *cell,
   GtkCellRendererPixbuf *cellpixbuf = (GtkCellRendererPixbuf *) cell;
   GtkCellRendererPixbufPrivate *priv;
   GdkPixbuf *pixbuf;
+  GdkPixbuf *invisible = NULL;
   GdkRectangle pix_rect;
   GdkRectangle draw_rect;
   gboolean stock_pixbuf = FALSE;
@@ -475,32 +472,29 @@ gtk_cell_renderer_pixbuf_render (GtkCellRenderer      *cell,
 
   if (GTK_WIDGET_STATE (widget) == GTK_STATE_INSENSITIVE || !cell->sensitive)
     {
-      if (!priv->insensitive)
-       {
-         GtkIconSource *source;
+      GtkIconSource *source;
       
-         source = gtk_icon_source_new ();
-         gtk_icon_source_set_pixbuf (source, pixbuf);
-         /* The size here is arbitrary; since size isn't
-          * wildcarded in the souce, it isn't supposed to be
-          * scaled by the engine function
-          */
-         gtk_icon_source_set_size (source, GTK_ICON_SIZE_SMALL_TOOLBAR);
-         gtk_icon_source_set_size_wildcarded (source, FALSE);
-         
-         priv->insensitive = gtk_style_render_icon (widget->style,
-                                                    source,
-                                                    gtk_widget_get_direction (widget),
-                                                    GTK_STATE_INSENSITIVE,
-                                                    /* arbitrary */
-                                                    (GtkIconSize)-1,
-                                                    widget,
-                                                    "gtkcellrendererpixbuf");
-
-         gtk_icon_source_free (source);
-       }
+      source = gtk_icon_source_new ();
+      gtk_icon_source_set_pixbuf (source, pixbuf);
+      /* The size here is arbitrary; since size isn't
+       * wildcarded in the souce, it isn't supposed to be
+       * scaled by the engine function
+       */
+      gtk_icon_source_set_size (source, GTK_ICON_SIZE_SMALL_TOOLBAR);
+      gtk_icon_source_set_size_wildcarded (source, FALSE);
       
-      pixbuf = priv->insensitive;
+     invisible = gtk_style_render_icon (widget->style,
+                                       source,
+                                       gtk_widget_get_direction (widget),
+                                       GTK_STATE_INSENSITIVE,
+                                       /* arbitrary */
+                                       (GtkIconSize)-1,
+                                       widget,
+                                       "gtkcellrendererpixbuf");
+     
+     gtk_icon_source_free (source);
+     
+     pixbuf = invisible;
     }
 
   if (gdk_rectangle_intersect (cell_area, &pix_rect, &draw_rect) &&
@@ -517,4 +511,7 @@ gtk_cell_renderer_pixbuf_render (GtkCellRenderer      *cell,
                     draw_rect.height,
                     GDK_RGB_DITHER_NORMAL,
                     0, 0);
+  
+  if (invisible)
+    g_object_unref (invisible);
 }